#ifndef Network_h
#define Network_h

#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string>
#include <vector>

class CNetwork
{
public:
    CNetwork();

    virtual ~CNetwork();

    virtual bool Init();

    virtual bool Run();

    virtual bool SendData(char* pData, int nLen);

    static std::string trim(const std::string& str);

    // 计算校验和
    unsigned char CheckSumNet(char* szData, int nLen);

    std::string CheckSum(const std::vector<char>& listData);
public:
    // server socket
    int m_socketServer;

    // server port
    int m_nPort;

    // is running
    bool m_bIsRunning;
};

#endif // Network_h